$OpenBSD: patch-src_osdep_openbsd_c,v 1.5 2016/09/10 13:03:43 ajacoutot Exp $
--- src/osdep/openbsd.c.orig	Tue Feb 26 19:12:19 2008
+++ src/osdep/openbsd.c	Sat Sep 10 12:18:30 2016
@@ -19,26 +19,26 @@
   */
 #include <sys/types.h>
 #include <sys/endian.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/param.h>
 #include <sys/sysctl.h>
-#include <net/bpf.h>
+#include <sys/select.h> /* fd_set */
 #include <sys/socket.h>
+#include <sys/timeout.h>
+#include <sys/ioctl.h>
+#include <net/bpf.h>
 #include <net/if.h>
 #include <net/if_media.h>
-#include <sys/ioctl.h>
 #include <net/if_dl.h>
+#include <net/if_var.h>
 #include <net80211/ieee80211.h>
-#include <net80211/ieee80211_crypto.h>
 #include <net80211/ieee80211_ioctl.h>
 #include <net80211/ieee80211_radiotap.h>
-#include <net80211/ieee80211_proto.h>
+
+#include <errno.h>
+#include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <sys/uio.h>
 #include <assert.h>
 #include <ifaddrs.h>
 
@@ -273,7 +273,7 @@ static int obsd_write(struct wif *wi, unsigned char *h
 	if (rc == -1)
 		return rc;
 
-	return 0;
+	return rc;
 }
 
 static void do_free(struct wif *wi)
@@ -303,7 +303,7 @@ static int do_obsd_open(struct wif *wi, char *iface)
         int s;
         unsigned int flags;
         struct ifmediareq ifmr;
-        int *mwords;
+        uint64_t *mwords;
 	struct priv_obsd *po = wi_priv(wi);
 	unsigned int size=sizeof(po->po_buf);
 
@@ -339,7 +339,7 @@ static int do_obsd_open(struct wif *wi, char *iface)
 
         assert(ifmr.ifm_count != 0);
 
-        mwords = (int *)malloc(ifmr.ifm_count * sizeof(int));
+        mwords = (uint64_t *)malloc(ifmr.ifm_count * sizeof(uint64_t));
         if (!mwords)
 		goto close_sock;
         ifmr.ifm_ulist = mwords;
